package com.ruoyi.report.service.impl;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.report.domain.TPopularizeLaw;
import com.ruoyi.report.mapper.TPopularizeLawMapper;
import com.ruoyi.report.service.ITPopularizeLawService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 普法文章Service业务层处理
 * 
 * @author administrator
 * @date 2025-02-16
 */
@Service
public class TPopularizeLawServiceImpl implements ITPopularizeLawService
{
    @Autowired
    private TPopularizeLawMapper tPopularizeLawMapper;

    /**
     * 查询普法文章
     * 
     * @param id 普法文章ID
     * @return 普法文章
     */
    @Override
    public TPopularizeLaw selectTPopularizeLawById(Long id)
    {
        return tPopularizeLawMapper.selectTPopularizeLawById(id);
    }

    /**
     * 查询普法文章列表
     * 
     * @param tPopularizeLaw 普法文章
     * @return 普法文章
     */
    @Override
    public List<TPopularizeLaw> selectTPopularizeLawList(TPopularizeLaw tPopularizeLaw)
    {
        return tPopularizeLawMapper.selectTPopularizeLawList(tPopularizeLaw);
    }

    /**
     * 新增普法文章
     * 
     * @param tPopularizeLaw 普法文章
     * @return 结果
     */
    @Override
    public int insertTPopularizeLaw(TPopularizeLaw tPopularizeLaw)
    {
        tPopularizeLaw.setCreateTime(DateUtils.getNowDate());
        return tPopularizeLawMapper.insertTPopularizeLaw(tPopularizeLaw);
    }

    /**
     * 修改普法文章
     * 
     * @param tPopularizeLaw 普法文章
     * @return 结果
     */
    @Override
    public int updateTPopularizeLaw(TPopularizeLaw tPopularizeLaw)
    {
        return tPopularizeLawMapper.updateTPopularizeLaw(tPopularizeLaw);
    }

    /**
     * 删除普法文章对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteTPopularizeLawByIds(Map<String,String> map)
    {
        String ids = map.get("ids");
        if (ids.isEmpty()) {
            return 0;
        }
        String[] split = ids.split(",");
        List<String> list = Arrays.asList(split);
        return tPopularizeLawMapper.deleteTPopularizeLawByIds(list);
    }

    /**
     * 删除普法文章信息
     * 
     * @param id 普法文章ID
     * @return 结果
     */
    @Override
    public int deleteTPopularizeLawById(Long id)
    {
        return tPopularizeLawMapper.deleteTPopularizeLawById(id);
    }
}
